import request from '@/utils/request'

/**
 * 获取组织架构
 * @param {*}
 * @returns
 */
export function getDepartments() {
  return request({
    url: '/company/department',
    method: 'GET'
  })
}

/**
 *  删除部门
 * @returns {*} id 部门id
 */
export function delDeptById(id) {
  return request({
    url: '/company/department/' + id,
    method: 'DELETE'
  })
}

/**
 * 新增部门
 * @param {*} data
 * @returns
 */
export function addDepartment(data) {
  return request({
    url: '/company/department',
    method: 'POST',
    data
  })
}

/**
 * 修改部门
 * @param {*} data
 * @returns
 */
export function updateDepartments(data) {
  return request({
    url: '/company/department/' + data.id,
    method: 'PUT',
    data
  })
}
